// components/authorization/authorization.js
Component({
  /**
   * 组件的初始数据
   */
  data: {
    isLogin: false
  },
  lifetimes: {
    attached() {
      const isLogin = !!getApp().getToken()
      // console.log(isLogin);
      this.setData({
        isLogin
      })
      // 获取页面栈
      const pageStack = getCurrentPages()
      // 获取页面路径
      const currentPage = pageStack.pop()
      console.log(currentPage.route);
      if (!isLogin) {
        wx.redirectTo({
          url: '/pages/login/login?redirectURL=/'+ currentPage.route,
        })
      }
    }
  }

})